<template>
  <!-- 树状结构 -->
  <div>
    <Input></Input>
    <el-tree
      :data="list"
      :props="defaultProps"
      @node-click="handleNodeClick"
    ></el-tree>
  </div>
</template>

<script>
import Input from './Input.vue';
export default {
  components: { Input },
  name: "Tree",
  data() {
    return {
      array: {},
      list: [],
      // 默认
      defaultProps: {
        label: "label",
        children: "children",
      },
    };
  },
  methods: {
    handleNodeClick(list) {
      console.log(list);
    },
    getGrade() {
      this.getRequest("/wework/department/tree").then((resp) => {
        console.log("gggg");
        console.log(resp);
        this.array = resp.data.data;
        this.list = [this.array];
      });
    },
  },
  mounted() {
    this.getGrade();
  },
};
</script>
<style scoped> 
.el-select .el-input {
  width: 130px;
}
.input-with-select .el-input-group__prepend {
  background-color: #fff;
}
</style>